import { EntitySchema } from '@mikro-orm/core';

export class LeGalleryGroup {
  id!: string;
  name!: string;
  parentId!: string;
  path!: string;
  sort: number = 1;
  UID!: string;
  merchantId!: string;
  AppID!: string;
  createdTime!: string;
  updatedTime?: string;
  deletedTime?: string;
  isDeleted: boolean = false;
  type: boolean = true;
}

export const LeGalleryGroupSchema = new EntitySchema({
  class: LeGalleryGroup,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    name: { type: 'string', length: 50 },
    parentId: { type: 'string', columnType: 'bigint', defaultRaw: `0`, index: '父级id' },
    path: { type: 'string', length: 255, default: '0' },
    sort: { type: 'number', columnType: 'smallint', default: 1 },
    UID: { type: 'string', fieldName: 'UID', columnType: 'bigint' },
    merchantId: { type: 'string', columnType: 'bigint', index: '商户id' },
    AppID: { type: 'string', fieldName: 'AppID', length: 50, index: '应用id' },
    createdTime: { type: 'string', columnType: 'bigint' },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true },
    isDeleted: { type: 'boolean', default: false },
    type: { type: 'boolean', default: true },
  },
});
